package aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @author DJJ_F
 * @version 1.0
 * @date 2025/01/19
 * @description 安全切面类，为了测试切面顺序
 */
@Component
@Aspect
@Order(1)
public class SecurityAspect {
//    @Around("execution(public * service..*(..))")
    public void around(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("安全：前环绕通知");
        // 执行目标方法, 连接点
        joinPoint.proceed();
        System.out.println("安全：后环绕通知");
    }

    @Before("execution(public * service.impl..*(..))")
    public void loginCheck() {
        System.out.println("安全：前置通知");
    }
}
